<?php
/*
 *  This file is part of Urd.
 *
 *  Urd is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *  Urd is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program. See the file "COPYING". If it does not
 *  exist, see <http://www.gnu.org/licenses/>.
 *
 * $LastChangedDate: 2008-11-29 00:39:31 +0100 (Sat, 29 Nov 2008) $
 * $Rev: 301 $
 * $Author: gavinspearhead $
 * $Id: urdd_protocol.php 301 2008-11-28 23:39:31Z gavinspearhead $
 */

// This is an include-only file:
if (!defined('ORIGINAL_PAGE')) die('This file cannot be accessed directly.');


define ('COMMAND_REPEAT_LAST_COMMAND', 1);
define ('COMMAND_ADDDATA', 46);
define ('COMMAND_CANCEL', 2);
define ('COMMAND_CHECK_VERSION', 37);
define ('COMMAND_CLEANDB', 32);
define ('COMMAND_CLEANDIR', 34);
define ('COMMAND_CONTINUE', 3);
define ('COMMAND_DISKFREE', 5);
define ('COMMAND_DELETE_SET', 56);
define ('COMMAND_DELETE_SET_RSS', 57);
define ('COMMAND_DOWNLOAD', 7);
define ('COMMAND_DOWNLOAD_ACTION', 43);
define ('COMMAND_ECHO', 8);
define ('COMMAND_EXIT', 10);
define ('COMMAND_EXPIRE', 11);
define ('COMMAND_EXPIRE_RSS', 51);
define ('COMMAND_FINDSERVERS', 54);
define ('COMMAND_GENSETS', 45);
define ('COMMAND_GETSETINFO', 42);
define ('COMMAND_GROUP', 12);
define ('COMMAND_GROUPS', 13);
define ('COMMAND_HELP', 14);
define ('COMMAND_MAKE_NZB', 47);
define ('COMMAND_MERGE_SETS', 53);
define ('COMMAND_MOVE', 44);
define ('COMMAND_NOOP', 15);
define ('COMMAND_OPTIMISE', 16);
define ('COMMAND_PARSE_NZB', 48);
define ('COMMAND_PASS', 17);
define ('COMMAND_PAUSE', 18);
define ('COMMAND_POST', 58);
define ('COMMAND_POST_ACTION', 59);
define ('COMMAND_POST_MESSAGE', 61);
define ('COMMAND_PREEMPT', 29);
define ('COMMAND_PRIORITY', 39);
define ('COMMAND_PURGE', 19);
define ('COMMAND_PURGE_RSS', 52);
define ('COMMAND_QUIT', 20);
define ('COMMAND_RESTART', 55);
define ('COMMAND_SCHEDULE', 21);
define ('COMMAND_SENDSETINFO', 41);
define ('COMMAND_SET', 40);
define ('COMMAND_SHOW', 22);
define ('COMMAND_SHUTDOWN', 23);
define ('COMMAND_START_POST', 60);
define ('COMMAND_STATUS', 24);
define ('COMMAND_STOP', 30);
define ('COMMAND_SUBSCRIBE', 26);
define ('COMMAND_SUBSCRIBE_RSS', 50);
define ('COMMAND_TIME', 35);
define ('COMMAND_UNPAR_UNRAR', 31);
define ('COMMAND_UNSCHEDULE', 27);
define ('COMMAND_UPDATE', 28);
define ('COMMAND_UPDATE_RSS', 49);
define ('COMMAND_UPTIME', 33);
define ('COMMAND_USER', 36);
define ('COMMAND_VERSION', 38);
define ('COMMAND_WHOAMI', 62); // always keep this the highest number !!

$responses = array (
    // single line responses
    200 => "200 Command ok.\n",
    201 => "201 [%s] Command ok.\n",
    202 => "202 %s Command ok.\n",
    210 => "210 (%d) %s Download created .\n",
    221 => "221 Goodbye.\n",
    222 => "222 Shutting down.\n",
    223 => "223 Restarting.\n",
    231 => "231 Ok.\n",
    240 => "240 User logged in. Proceed.\n",
    299 => "299 Urdd version %s.\n", 

    331 => "331 User name okay, need password.\n",
    332 => "332 Need account for login.\n",

    401 => "401 NNTP server not available.\n",
    402 => "402 Queue full.\n",
    403 => "403 Already queued.\n",
    404 => "404 %s Queue full; some actions scheduled.\n",
    405 => "405 Creating download failed.\n", 
    406 => "406 Already running.\n",
    410 => "410 NNTP Connections disabled.\n",

    500 => "500 Syntax error: command not recognised: %s.\n",
    501 => "501 Syntax error: argument not recognised.\n",
    502 => "502 Command not implemented.\n",
    503 => "503 An error occured %s.\n",
    504 => "504 Required module not loaded: %s.\n",
    510 => "510 Task not found.\n",
    511 => "511 Job not found.\n",
    512 => "512 Download not found.\n",
    513 => "513 Set not found.\n",
    520 => "520 No groups found.\n",
    521 => "521 Invalid timestamp.\n",
    522 => "522 Invalid recurrence.\n",
    530 => "530 Not logged in.\n",
    531 => "531 Invalid username or password.\n",
    532 => "532 Requires admin privileges.\n",
    533 => "533 Function disabled by administrator.\n",

    // multi line responses
    251 => "251 Urdd server status.\n",
    252 => "252 The following commands are recognised.\n",
    253 => "253 Showing\n",
    254 => "254 Echo:\n",
    255 => "255 Debug info:\n",
    256 => "256 Diskspace available:\n",
    257 => "257 Help for command:\n",
    258 => "258 Group information:\n",
    259 => "259 Uptime:\n",
    260 => "260 Server time:\n",
    261 => "261 User name:\n",
    262 => "262 Version:\n",
    263 => "263 Diskspace percentage:\n"
);


?>
